<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Playbook</title>

    <!-- Bootstrap Core CSS -->
    <link href="/static/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="/static/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="/static/dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="/static/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="http://apps.bdimg.com/libs/jqueryui/1.9.2/themes/smoothness/jquery-ui.css">
	<link rel="stylesheet" type="text/css" href="/static/elfinder/css/elfinder.full.css">
</head>

<body>

    <div id="wrapper">

		<!-- Navigation -->
		<nav class="navbar navbar-default navbar-static-top" role="navigation"
			style="margin-bottom: 0">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle" data-toggle="collapse"
					data-target=".navbar-collapse">
					<span class="sr-only">Toggle navigation</span> <span
						class="icon-bar"></span> <span class="icon-bar"></span> <span
						class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="/">OpsManage v2.0</a>
			</div>
			<!-- /.navbar-header -->

			<ul class="nav navbar-top-links navbar-right">
				<li class="dropdown"><a class="dropdown-toggle"
					data-toggle="dropdown" href="#"> <i class="fa fa-bell fa-fw">
					</i><span class="badge" id="deploy_order_count"></span> <i
						class="fa fa-caret-down"></i>

				</a>
					<ul class="dropdown-menu dropdown-messages" id="deploy_order">
					</ul> <!-- /.dropdown-messages --></li>
				<!-- /.dropdown -->
				<li class="dropdown"><a class="dropdown-toggle"
					data-toggle="dropdown" href="#"> {{user}} <i
						class="fa fa-user fa-fw"></i>
					<iclass ="fafa-caret-down">
						</i></a>
					<ul class="dropdown-menu dropdown-user">
						<li><a href="/user/center/"><i class="fa fa-user fa-fw"></i>
								User Profile</a></li>
						<li><a href="#"><i class="fa fa-gear fa-fw"></i> Settings</a>
						</li>
						<li class="divider"></li>
						<li><a href="/logout"><i class="fa fa-sign-out fa-fw"></i>
								Logout</a></li>
					</ul> <!-- /.dropdown-user --></li>
				<!-- /.dropdown -->
			</ul>
			<!-- /.navbar-top-links -->

			<div class="navbar-default sidebar" role="navigation">
				<div class="sidebar-nav navbar-collapse">
					<ul class="nav" id="side-menu">
						<li class="sidebar-search">
							<div class="input-group custom-search-form">
								<input type="text" class="form-control" placeholder="Search...">
								<span class="input-group-btn">
									<button class="btn btn-default" type="button">
										<i class="fa fa-search"></i>
									</button>
								</span>
							</div> <!-- /input-group -->
						</li>
						<li><a href="/"><i class="fa fa-dashboard fa-fw"></i>
								Dashboard</a></li>
						<li><a href="#"><i class="fa  fa-bank fa-fw"></i> 资产管理<span
								class="fa arrow"></span></a>
							<ul class="nav nav-second-level">
								<li><a href="/assets_config">基础配置</a></li>
								<li><a href="/assets_add">添加资产</a></li>
								<li><a href="/assets_list">资产列表</a></li>
								<li><a href="/assets_search/">资产查询</a></li>
								<li><a href="/assets_log/1/">操作日志</a></li>
							</ul> <!-- /.nav-second-level --></li>
						<li><a href="#"><i class="fa fa-hdd-o fa-fw"></i> 代码发布<span
								class="fa arrow"></span></a>
							<ul class="nav nav-second-level">
								<li><a href="/deploy_add">项目配置</a></li>
								<li><a href="/deploy_list">项目列表</a></li>
								<li><a href="/deploy_order/1/">部署工单</a></li>
								<li><a href="/deploy_log/1/">操作日志</a></li>
							</ul> <!-- /.nav-second-level --></li>
						<li><a href="#"><i class="fa fa-table fa-fw"></i> 任务管理<span
								class="fa arrow"></span></a>
							<ul class="nav nav-second-level">
								<li><a href="/cron_add">添加任务</a></li>
								<li><a href="/cron_config">批量导入</a></li>
								<li><a href="/cron_list/1/">任务列表</a></li>
								<li><a href="/cron_log/1/">操作日志</a></li>
							</ul> <!-- /.nav-second-level --></li>
						<li><a href="#"><i class="fa fa-sitemap fa-fw"></i> 应用部署<span
								class="fa arrow"></span></a>
							<ul class="nav nav-second-level">
								<li><a href="/apps/inventory/">动态资产</a></li>
								<li><a href="/apps/model/">运行模块</a></li>
								<li><a href="#">脚本工具<span class="fa arrow"></span></a>
									<ul class="nav nav-third-level">
										<li><a href="/apps/script/online/">在线添加</a></li>
										<li><a href="/apps/script/list/">脚本列表</a></li>
									</ul></li>
								<li><a href="#">剧本配置<span class="fa arrow"></span></a>
									<ul class="nav nav-third-level">
										<li><a href="/apps/playbook/upload/">上传剧本</a></li>
										<li><a href="/apps/playbook/online/">在线编辑</a></li>
										<li><a href="/apps/">剧本列表</a></li>
										{% if user.is_superuser %}
											<li><a href="/roles/">剧本管理</a></li>
										{% endif %}
									</ul> <!-- /.nav-third-level --></li>
								<li><a href="/apps/log/">操作日志</a></li>
							</ul> <!-- /.nav-second-level --></li>
						<li><a href="#"><i class="fa fa-database fa-fw"></i> 数据管理<span
								class="fa arrow"></span></a>
							<ul class="nav nav-second-level">
								<li><a href="#">MySQL<span class="fa arrow"></span></a>
									<ul class="nav nav-third-level">
										<li><a href="/db/config/">基础配置</a></li>
										<li><a href="/db/sql/ops/">管理入口</a></li>											
									</ul>
								</li>														
								<li><a href="/db/sql/logs/1/">操作日志</a></li>
							</ul> <!-- /.nav-second-level --></li>							
						{% if user.is_superuser %}
						<li><a href="#"><i class="fa fa-tasks fa-fw"></i> 任务调度<span
								class="fa arrow"></span></a>
							<ul class="nav nav-second-level">
								<li><a href="/task_model/">调度类型</a></li>
								<li><a href="/task_view/">运行日志</a></li>
							</ul> <!-- /.nav-second-level --></li>
						{% endif %}
						<li><a href="#"><i class="fa fa-bookmark fa-fw"></i> 运维知识<span
								class="fa arrow"></span></a>
							<ul class="nav nav-second-level">
								<li><a href="/wiki/add/">新建文档</a></li>
								<li><a href="/wiki/index/">文档列表</a></li>
							</ul> <!-- /.nav-second-level --></li>	
						<li><a href="#"><i class="fa  fa-ticket fa-fw"></i> 工单系统<span
								class="fa arrow"></span></a>
							<ul class="nav nav-second-level">
								<li><a href="#">工单申请<span class="fa arrow"></span></a>
									<ul class="nav nav-third-level">
										<li><a href="/order/deploy/apply/">代码部署</a></li>
										<li><a href="/order/sql/apply/">上线SQL</a></li>
										<li><a href="/order/file/upload/list/1/">文件分发</a></li>
										<li><a href="/order/file/download/list/1/">文件下载</a></li>
									</ul></li>
								<li><a href="/order/list/1/">工单列表</a></li>
								<li><a href="/order/search/">工单查询</a></li>
							</ul> <!-- /.nav-second-level --></li>													
						<li><a href="/config"><i class="fa fa-wrench fa-fw"></i>
								全局配置</a></li>
						<li><a href="#"><i class="fa fa-group "></i> 用户中心<span
								class="fa arrow"></span></a>
							<ul class="nav nav-second-level">
								<li><a href="/users/manage">用户管理</a></li>
								<li><a href="/user/center/">用户配置</a></li>
								<li><a href="/logout">退出</a></li>
							</ul> <!-- /.nav-second-level --></li>
					</ul>
				</div>
				<!-- /.sidebar-collapse -->
			</div>
			<!-- /.navbar-static-side -->
		</nav>

        <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header"><i class="fa  fa-wrench"></i><code>Playbook Roles</code>管理</h1>
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <div id="finder"></div>

            </div>
            <!-- /.container-fluid -->           
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="/static/elfinder/plugins/jQuery/jquery-2.2.3.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
	<script src="/static/vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="/static/vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="/static/dist/js/sb-admin-2.js"></script>

<!-- <script src="/static/elfinder/plugins/jQuery/jquery-2.2.3.min.js"></script> -->
<!-- jQuery UI 1.11.4 -->
<!-- <script src="/static/elfinder/plugins/jquery-ui/jquery-ui.min.js"></script> -->
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
/*   $.widget.bridge('uibutton', $.ui.button); */
</script>
<!-- Bootstrap 3.3.6 -->
<!-- <script src="/static/elfinder/plugins/bootstrap/js/bootstrap.min.js"></script> 
<!-- AdminLTE App -->
<script src="/static/elfinder/js/app.min.js"></script>
<!-- toastr js-->

<script src="/static/elfinder/plugins/toastr/toastr.min.js"></script>

<script>

function getCookie(name) {
	var cookieValue = null;
	if (document.cookie && document.cookie !== '') {
		var cookies = document.cookie.split(';');
		for (var i = 0; i < cookies.length; i++) {
			var cookie = jQuery.trim(cookies[i]);
			// Does this cookie string begin with the name we want?
			if (cookie.substring(0, name.length + 1) === (name + '=')) {
				cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
				break;
			}
		}
	}
	return cookieValue;
}
var csrftoken = getCookie('csrftoken');
function csrfSafeMethod(method) {
	// these HTTP methods do not require CSRF protection
	return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
$.ajaxSetup({
	beforeSend: function(xhr, settings) {
		if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
			xhr.setRequestHeader("X-CSRFToken", csrftoken);
		}
	}
});


toastr.options = {
    "closeButton": false,
    "debug": false,
    "newestOnTop": false,
    "progressBar": false,
    "positionClass": "toast-top-center",
    "preventDuplicates": false,
    "onclick": null,
    "showDuration": "300",
    "hideDuration": "1000",
    "timeOut": "5000",
    "extendedTimeOut": "1000",
    "showEasing": "swing",
    "hideEasing": "linear",
    "showMethod": "fadeIn",
    "hideMethod": "fadeOut"
}
</script>
<script src="/static/elfinder/plugins/jquery-ui/jquery-ui.js"></script>
<!-- elFinder JS (REQUIRED) -->
<script src="/static/elfinder/js/elfinder.full.js"></script>
<script type="text/javascript" charset="utf-8">
(function($){
        var i18nPath = 'js/i18n',
                start = function(lng) {
                        // disable HTML quicklook plugin
                        elFinder.prototype.commands.quicklook.plugins[1] = null;
                        <!--var high = $('body').find('.sidebar')[0].clientHeight;-->
                        $().ready(function() {
                                //console.log($(".content"));
                                // Documentation for client options:
                                // https://github.com/Studio-42/elFinder/wiki/Client-configuration-options
                                var elfinderInstance = $('#finder').elfinder({
                                        resizable: false,
                                        height: '100%',	
                                        url: '/elfinder/yawd-connector/sftp/Files/', // connector URL (REQUIRED)
                                        //url: 'http://hypweb.net/elFinder-nightly/demo/2.1/php-jsb/basic.php',
                                        lang: lng,                    // language (OPTIONAL)
                                        debug: ['error', 'warning', 'event-destroy'],
                                        dragUploadAllow: true,
                                        soundPath: "/static/elfinder/sounds/"
                                }).elfinder('instance');

                                // set document.title dynamically etc.
                                var title = document.title;
                                elfinderInstance.bind('open', function(event) {
                                        var data = event.data || null;
                                        var path = '';
                                        
                                        if (data && data.cwd) {
                                                path = elfinderInstance.path(data.cwd.hash) || null;
                                        }
                                        document.title =  path? path + ':' + title : title;
                                });

                                // fit to window.height on window.resize
                                <!--var resizeTimer = null;-->
                                <!--$(window).resize(function() {-->
                                        <!--resizeTimer && clearTimeout(resizeTimer);-->
                                        <!--resizeTimer = setTimeout(function() {-->
                                                <!--var h = parseInt(high);-->
                                                <!--if (h != parseInt($('#finder').height())) {-->
                                                        <!--elfinderInstance.resize('1000px', high);-->
                                                <!--}-->
                                        <!--}, 0);-->
                                <!--});-->
                        });
                },
                loct = window.location.search,
                full_lng, locm, lng;
        
        // detect language
        if (loct && (locm = loct.match(/lang=([a-zA-Z_-]+)/))) {
                full_lng = locm[1];
        } else {
                full_lng = (navigator.browserLanguage || navigator.language || navigator.userLanguage);
        }
        lng = full_lng.substr(0,2);
        if (lng == 'ja') lng = 'jp';
        else if (lng == 'pt') lng = 'pt_BR';
        else if (lng == 'zh') lng = (full_lng.substr(0,5) == 'zh-tw')? 'zh_TW' : 'zh_CN';

        if (lng != 'en') {
                $.ajax({
                        url : '',
                        cache : true,
                        dataType : 'script'
                })
                .done(function() {
                        start(lng);
                })
                .fail(function() {
                        start('en');
                });
        } else {
                start(lng);
        }
})(jQuery);
</script>    

</body>

</html>
